<?php
    header('content-type:text/html;charset=utf8');

    $username = "老王";
    $phone = "8638863";

    # 链接
    $link = mysql_connect('localhost','root','root');

    if(!$link){
        die("数据库链接失败：".mysql_error());
    }

    # 选择数据库
    mysql_select_db('test');
    mysql_query("set names utf8");

    # 操作数据库
    # 1.编写sql语句
    $sql = "INSERT INTO `userlist` 
            (`username`, `phone`) 
            VALUES
            ('$username' , '$phone') 
      ";
    echo $sql;
    # 2.执行sql语句
    mysql_query($sql);
    
    
    # 关闭
    mysql_close($link);
?>